type
	pp=^person;
	person=record
		name:char;
		vote:integer;
	end;
var
	a:array[0..3] of person;
	b:array[0..3] of pp;
	temp:pp;
	i,j:integer;
	c:char;
begin
	{初始化}
	for i:=0 to 3 do
	begin
		a[i].name:=chr(ord('A')+i);
		a[i].vote:=0;
		b[i]:=@a[i];
	end;

	{读入}
	while true do
	begin
		read(c);
		if(c='#') then break;
		if(ord('A')<=ord(c)) and (ord(c)<=ord('D') )then
			inc(a[ord(c)-ord('A')].vote);
		if(ord('a')<=ord(c)) and (ord(c)<=ord('d') )then
			inc(a[ord(c)-ord('a')].vote);
	end;

	{插入排序}
	for i:=1 to 3 do
	begin
		temp:=b[i];
		for j:=i-1 downto 0 do
		if temp^.vote>b[j]^.vote then
		begin
			b[j+1]:=b[j];
			b[j]:=temp;
		end;
	end;

	{输出}
	for i:=0 to 3 do
		writeln(b[i]^.name,' : ',b[i]^.vote);
end.
